package www.tvbigo.cn.xiaoxuan.widget;

import www.tvbigo.cn.xiaoxuan.R;
import android.app.Fragment;
import android.graphics.Color;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;

public class BaseFragment extends Fragment
{
    
    /**
     * 当前的ImageView 添加边框时
     */
    ImageView currentImage;
    
    /**
     * 提供选中放大的效果
     */
    public View.OnFocusChangeListener mFocusChangeListener = new View.OnFocusChangeListener()
    {
        
        @Override
        public void onFocusChange(View v, boolean hasFocus)
        {
            
            int focus = 0;
            if (hasFocus)
            {
                focus = R.anim.anim_scale_big;
            }
            else
            {
                focus = R.anim.anim_scale_small;
            }
            // 如果有焦点就放大，没有焦点就缩小
            Animation mAnimation = AnimationUtils.loadAnimation(getActivity().getApplication(), focus);
            mAnimation.setBackgroundColor(Color.TRANSPARENT);
            mAnimation.setFillAfter(hasFocus);
            v.startAnimation(mAnimation);
            mAnimation.start();
            v.bringToFront();
        }
    };
    
}
